home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
5791-.end
/
dmg-6260
/
articles
/
bankappn.doc
< prev
next >
Wrap
Text File
|
1993-07-24
|
4KB
|
102 lines
BLACK EAGLE'S BANK APPENDER
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is another little utility that I have written. As you must well
know, STOS has a maximum of 15 memory banks. But what if you had 16
packed picture files, or 20 pieces of music, or 25 samples???
This utility can take lots of files and make them into one big file.
All you need to do is remember the lengths and offsets of each file,
which can be listed at any time. There is also an extra feature here. I
had recently been watching '2010' on the telly, and H.A.L. gave me an
idea. Most actions are now accompanied by my sampled speech! I even
read out the lengths of files to you! (Oh dear)
You are primarily presented with the main menu. Here, you have several
options:
LOAD BANK (adds another file to the current bank)
SAVE BANK (saves the whole chunk)
INFORMATION (provides you with the numbers, lengths, names, and offsets
of each file in the bank)
DELETE (erases any one file from the databank, and closes the
empty gap)
CLEAR (erases all of the data)
QUIT (quits)
STOS BANK? (toggles STOS Bank on/off - see later on)
CHANGE DRIVE allows you to change from drive A to B and back.
SAVE INFO-BLOCK saves a list of the offsets and lengths.
PACK FILE actually compacts a datablock, using the SQUASHER packer.
There is an option to toggle STOS Bank on/off. This is for use with
propor STOS Banks, like packed pictures, sprites, icons, etc. Non-STOS
Banks are things like pictures, samples, binary data, etc. Generally,
when you ask to save the data, it either SAVEs it or BSAVEs it.
Here is an example of how to use an appended bank:
Say you had 10 packed pictures you wanted for a game, and, due to also
needing music, samples, sprites etc. you had nowhere near enough memory
banks to include them all. You would load each packed picture file into
my appender, and make them all into one file. Before you leave, view
the information screen, and you will get a list of numbers. Get a piece
of paper and write down the lengths and offsets against each filename
in the bank. Number each file.
Load up your game so far, and set up two arrays, one for offsets and
one for lengths. Now, include a routine to list the offsets and
lengths into the arrays (probably by using DATA statements). Finally,
you are going to need an extra routine which will copy the required
block of data into an empty bank, ready for unpacking, viewing,
playing, or whatever.
So, let's say we had created the following appended bank:
NUMBER FILENAME OFFSET LENGTH
----------------------------------------
1 title.mbk $0 6144
2 options.mbk $1800 10240
3 gameover.mbk $4000 8704
4 loselife.mbk $6200 10240
5 cheat.mbk $8A00 5120
Now, sometime during my game, I want to unpack and display the GAME
OVER picture. I would have a routine which extracts just the GAME OVER
picture from the main bank, copies it to a spare bank, unpacks it, and
displays it:
10 dim o(5),l(5)
20 restore 40
30 for t=1 to 5 : read o(t) : next t
40 data 0,$1800,$4000,$6200,$8A00
50 for t=1 to 5 : read l(t) : next t
60 data 6144,10240,8704,10240,5120
70 :
80 :
100 rem MAIN GAME GOES HERE.....
110 :
645 rem I WANT TO DISPLAY THE 'GAME OVER' PICTURE HERE
646 :
647 NUM=3 : rem (GAME OVER is the 3rd block of data)
648 gosub 1000 : rem MY NIFTY EXTRACTING ROUTINE
649 rem DATA IS RETURNED IN BANK 11 WHICH IS RESERVED FOR SOLELY THIS
PURPOSE
650 unpack 11,physic
651 rem CARRY ON.
1000 rem MY NIFTY EXTRACTING ROUTINE...
1001 fill start(11) to start(11)+length(11),0
1002 rem Clears the return bank
1003 kopy start(6)+o(num),start(11),l(num)
1004 rem Bank 6 holds the massive bank.
1005 return
There we are...
The datablock for the above example would have been saved with STOS
Bank ON. You CAN mix data types in one bank; like a sample, then a
picture, then a sprite bank, then some music. But remember, if there is
at least one STOS bank, then the whole lot will have to be saved as a
STOS Bank. (There is no length disadvantage or anything when using STOS
Banks)